Back to the Vavoom Forum Archives
mnk
if (CheckExtension("GLX_SGI_swap_control"))
{
GCon->Log(NAME_Init, "Swap control extension found.");
typedef int (APIENTRY *PFNWGLSWAPINTERVALFARPROC)(int);
PFNWGLSWAPINTERVALFARPROC wglSwapIntervalEXT = 0;
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC)glXGetProcAddressARB((const GLubyte *)"glXSwapIntervalSGI");
if( wglSwapIntervalEXT )
wglSwapIntervalEXT(r_vsync);
}
I'm not sure, this code is correct, as this was created mainly by google,
but it has a good chance to be, except perhaps for CheckExtension part,
as it does glGetString(GL_EXTENSIONS) and GLX_SGI_swap_control obviously is not one
(perhaps use glXQueryExtensionsString in such case - I've checked and it seems it does
find the extension that way).
Looks, like in SDL this would be handled by SDL_GL_SetAttribute with SDL_GL_SWAP_CONTROL
- better than adding glXQueryExtensionsString stuff.
PS: having reread a few pages, I'm almost sure that the correct way would be removing that block completely
from gl_main.cpp, adding SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, r_vsync) in gl_sdl.cpp
and doing whatever in one of the windows only files.Firebrand